<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Route::get('/', function () {
//    return view('welcome');
//});


Route::get('/', 'Home\IndexController@index');
Route::get('/company', 'Home\IndexController@company');
Route::get('/newslist', 'Home\IndexController@newslist');
Route::get('/new/{id}', 'Home\IndexController@new');
Route::get('/items', 'Home\IndexController@items');
Route::get('/project', 'Home\IndexController@project');
Route::get('/online', 'Home\IndexController@online');
Route::get('/contact', 'Home\IndexController@contact');
Route::get('/photo', 'Home\IndexController@photo');
//Route::group(['middleware' => ['admin.login']], function () {
//    // 后台首页
//    Route::any('admin/index', 'Admin\IndexController@index');
//    Route::any('admin/info', 'Admin\IndexController@info');
//    Route::any('admin/quit', 'Admin\LoginController@quit');
//});

Route::group([
    'middleware' => ['admin.login'],
    'prefix' => 'admin',
    'namespace' => 'Admin'], function () {
    Route::get('index', 'IndexController@index');
    Route::get('info', 'IndexController@info');
    Route::get('quit', 'LoginController@quit');
    Route::any('pass', 'IndexController@pass');

    Route::resource('category', 'CategoryController');
    Route::post('cate/changeorder', 'CategoryController@changeOrder');

    Route::resource('article', 'ArticleController');
    Route::any('upload', 'CommonController@upload');
});



// 后台登录
Route::any('admin/login', 'Admin\LoginController@login');
// 验证码
Route::get('admin/captcha', 'Admin\LoginController@captcha');













Route::get('admin/crypt', 'Admin\LoginController@crypt');


//微信服务
Route::any('/wechat', 'WechatController@serve');

Route::group(['middleware' => ['web']], function () {
    Route::get('/users', 'UsersController@users');
    Route::get('/users/{openId}', 'UsersController@user');

    Route::get('/image', 'MaterialController@image');
    Route::get('/audio', 'MaterialController@audio');
    Route::get('/images', 'MaterialController@images');
    Route::get('/message', 'MaterialController@message');
    Route::get('/text', 'MaterialController@text');
    Route::any('/menu', 'MenuController@menu');
});